package main

import (
	"context"
	"fmt"
	"github.com/micro/go-micro/service/grpc"
	"github.com/micro/go-micro"
	proto "micro-learning/proto/greeter"
)

type Say struct{}

func (s *Say) Hello(ctx context.Context, req *proto.HelloRequest, rsp *proto.HelloResponse) error {
	rsp.Greeting = "Hello " + req.Name
	return nil
}


func main() {
	service := grpc.NewService(
		micro.Name("greeter"),
	)

	service.Init()

	proto.RegisterGreeterHandler(service.Server(), new(Say))

	if err := service.Run(); err != nil {
		fmt.Println(err)
	}
}
